package space.sakana.edusysback.mapper.paper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import space.sakana.edusysback.entity.paper.PaperItem;

import java.util.List;

@Mapper
public interface PaperItemMapper {

    @Select("select `id`, `pid`, `index`, `qid`, `score` from paperitem where `id`=#{id};")
    PaperItem selectPaperItemById(int id);

    @Select("select `id`, `pid`, `index`, `qid`, `score` from paperitem where `pid`=#{pid};")
    List<PaperItem> selectPaperItemByPid(int pid);

    @Insert("insert into paperitem(`pid`, `index`, `qid`, `score`) values(#{pid}, #{index}, #{qid}, #{score});")
    int insertPaperItem(PaperItem paperItem);

    @Update("update paperitem set `pid`=#{pid}, `index`=#{index}, `qid`=#{qid}, `score`=#{score} where `id`=#{id};")
    int updatePaperItem(PaperItem paperItem);

}
